// -*- C++ -*-
//
//  This file is part of Siena, a wide-area event notification system.
//  See http://www.inf.usi.ch/carzaniga/siena/
//
//  Authors: Antonio Carzaniga
//  See the file AUTHORS for full details. 
//
//  Copyright (C) 2002-2003 University of Colorado
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
//  USA, or send email to one of the authors.
//
//
// $Id: bool_index.cc,v 1.9 2010-03-11 15:16:39 carzanig Exp $
//
#include "siena/forwarding.h"
#include "siena/allocator.h"

#include "bool_index.h"

namespace siena {

ConstraintType * BoolIndex::add_eq(bool v, FTAllocator & ftmemory) throw() {
    if (v) {
	if (t == 0) t = new (ftmemory)ConstraintType();
	return t;
    } else {
	if (f == 0) f = new (ftmemory)ConstraintType();
	return f;
    }
}

ConstraintType * BoolIndex::add_ne(bool v, FTAllocator & ftmemory) throw() {
    return add_eq(!v, ftmemory);
}

ConstraintType * BoolIndex::add_any(FTAllocator & ftmemory) throw() {
    if (any_value == 0)
	any_value = new (ftmemory)ConstraintType();
    return any_value;
}

}
